Generally, there are two types of methods for calculating motion vectors (MVs) in video decoding standards: calculating methods using information of surrounding blocks or macroblocks (MBs) (hereinafter referred to as NEI_CALC) and calculating methods using information of co-located blocks or MBs (hereinafter referred to as COLO_CALC).
NEI_CALC mainly involves the steps of: finding out relevant information of surrounding blocks of a block to be decoded currently (e.g. relevant information of blocks A, B, C and D as shown in FIG. 1) according to a size of the block to be decoded currently, and calculating a motion vector of the block to be decoded currently according to calculation steps defined in the video decoding standards by using the found information and other information of the block to be decoded currently (e.g. a vector motion difference, a motion vector prediction direction, etc.).
COLO_CALC mainly involves the steps of: finding out information of a co-located block in a backward reference frame (e.g. a motion vector and a reference frame picture index of the co-located block) according to a location of the block to be decoded currently, and calculating a motion vector of the block to be decoded currently according to calculation steps defined in the video decoding standards by using the found information.
Furthermore, methods of calculating boundary strengths (BSs) in the video decoding standards mainly use information of edges of the block to be decoded currently and blocks in which pixels adjacent to the block are located (e.g. microblock types, a quantize parameter (QP) value, block division, a non-zero bit number of block difference data and a difference value of motion vectors of the block) to calculate boundary strengths.
In the H.264 video decoding standard, in the case of a main level in a main profile, the block sizes NEI_CALC relates to range from 16×16 to 4×4, including 16×16, 16×8, 8×16, 8×8, 8×4, 4×8 and 4×4, wherein the smallest block is a 4×4 block, and the calculation modes NEI_CALC relates to include forward prediction (PRED_L0), backward prediction (PRED_L1), bi-directional prediction (PRED_BI) and a P frame skipped calculation mode. The block sizes COLO_CALC relates to involves 16×16 and 8×8 and the calculation modes it relates to includes spatial direct mode and temporal direct mode. Moreover, in the cases of single-directional predication (P frame) and bi-directional prediction (B frame), a prediction mode of calculating a weight value may be needed. For BS calculation, in a macroblock, in the worst case that calculation is performed by using edges of 4×4 blocks, there may be at most 40 sets of different BS values corresponding to different pixels of the macroblock respectively.
As can be seen from the above, the calculations of MV and BS in the video decoding standards have common points, for example, the use of information of surrounding blocks or macroblocks of the block to be decoded currently. However, due to different block sizes as well as complicated and diversified calculation modes when MV and BS are calculated respectively, the usual practice is to divide the calculations of MV and BS into two individual calculation sections and sequentially perform calculations of MV and BS with respect to a macroblock. For example, first of all, MV calculations are performed on blocks in a macroblock according to calculation modes of respective blocks in the macroblock to obtain MV values of all the blocks in the macroblock, then BS values of the macroblock is calculated by using the calculated MV values of all the blocks in the macroblock in combination with other obtainable information of the abovementioned macroblock/blocks. However, the abovementioned practice has the following inherent defects: firstly, calculations of MV and BS cannot be unified and the calculation speeds thereof are not stable due to different blocks and numerous calculation paths thereof; secondly, repetition of similar operations exists in the calculations of MV and BS due to failure to effectively use specific common points therebetween. For instance, in the worst situation that calculations of MV and BS are performed on a 4×4 block by using a calculation mode of bi-directional prediction, the time spent on the calculations of MV and BS is nearly twice as much as the time spent on a single calculation of MV.